import request from '@/utils/request';

export async function getPurchaseOrderDetailByPage(params: any) {
  return request('/api/material/getPurchaseOrderDetailByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addPurchaseOrderDetail(params: any) {
  return request('/api/material/addPurchaseOrderDetail', {
    method: 'POST',
    data: params,
  });
}

//物料详情
export async function getPurchaseOrderDetailByPoId(id: string, type: number, params: any) {
  return request('/api/material/getPurchaseOrderDetailByPoId', {
    method: 'POST',
    data: params,
    params: {
      purchaseOrderId: id,
      type: type,
    },
  });
}

export async function updatePurchaseOrderDetail(params: any) {
  return request('/api/material/updatePurchaseOrderDetail', {
    method: 'POST',
    data: params,
  });
}

export async function delPurchaseOrderDetail(params: any) {
  return request('/api/material/delPurchaseOrderDetail', {
    method: 'POST',
    data: params,
  });
}

export async function exportPurchaseOrderDetail(params: any) {
  return request('/api/material/exportPurchaseOrderDetail', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}
export default {
  getPurchaseOrderDetailByPage,
  addPurchaseOrderDetail,
  updatePurchaseOrderDetail,
  delPurchaseOrderDetail,
  exportPurchaseOrderDetail,
};
